package de.jare.photoswapper;


import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

import android.app.Activity;
import android.os.Bundle;
import android.provider.Settings.System;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;


public class Register extends Activity {
	HttpHandler h = new HttpHandler();
    public EditText gsm;

    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.register);
        
        Button bt3= (Button)findViewById(R.id.registerbt);
        bt3.setOnClickListener(getImgListener);
        
        gsm = (EditText) this.findViewById(R.id.register_gsm);
        

    }    

 
    
    View.OnClickListener getImgListener = new View.OnClickListener()
    {
          @Override
          public void onClick(View view) {
               // TODO eigentlich nur den request rausballern
        	  downloadFile("http://swap.ganzbunt.de/register.php?AndroidId="+h.AndroidID+"&gsm="+gsm);
          }
    };

    
    
    void downloadFile(String fileUrl){
        URL myFileUrl =null;          
        try {
             myFileUrl= new URL(fileUrl);
        } catch (MalformedURLException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
        }
        try {
             HttpURLConnection conn= (HttpURLConnection)myFileUrl.openConnection();
             conn.setDoInput(true);
             conn.connect();
             //int length = conn.getContentLength();
             InputStream is = conn.getInputStream();
        } catch (IOException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
        }
   }

    
   
}